package com.gaojiawei.multiThread14_ConcurrentHashMap;

import java.util.concurrent.ConcurrentHashMap;

public class L03_ConcurrentHashMapComputeIfPresentMethod {
    public static void main(String[] args) {
        ConcurrentHashMap<String, Integer> map = new ConcurrentHashMap<>();
        map.put("key1",1);
        Integer a = 2;
        map.computeIfPresent("key1",(key,oldvalue)->{
            return oldvalue+a;
        });
        System.out.println(map);
    }
}
